local ltime = require "ltime"
local time_help = {}
function time_help.isSameDay( timestamp )
	-- 默认是0 也不是同一天
	if timestamp == 0 then
		return false
	end 

	if ltime.getdayzero(os.time()) == ltime.getdayzero(timestamp) then
		return true
	else
		return false
	end
end

function time_help.IntervalDay( timestamp )
	
	if timestamp == 0 then
		return 1
	end 

	local now_day = ltime.getuday(os.time())
	local stamp_day = ltime.getuday(timestamp)

	if now_day >= stamp_day  then
		return now_day - stamp_day
	else 
		return 0
	end 
end

--2016-08-23 10:41:02转时间截
function time_help.g_string_time( date )
    local Y = string.sub(date,1,4)
    local M = string.sub(date,6,7)
    local D = string.sub(date,9,10)
    local H = string.sub(date,12,13)
    local MM = string.sub(date,15,16)
    local SS = string.sub(date,18,19)
    local dt1 = os.time{year=Y,month=M,day=D,hour=H,min=MM,sec=SS}
    return dt1
end
--时间截转日期
--local date = "" .. os.date("%Y-%m-%d %H:%M:%S", 1489549082)

return time_help